package com.hx.reflect;


import com.hx.reflect.bean.Student;

import java.lang.reflect.Field;
import java.lang.reflect.Method;

/**
 * @author jxlgcmh
 * @create 2019-05-11 11:44
 */
public class Demo7 {
    public static void main(String[] args) {
        Class<Student> clazz = Student.class;
        //获取当前类自己的所有public属性，含父类
//		Field[] fields = clazz.getDeclaredFields();
        //获取当前类自己的所有属性，不包含父类
        Field[] fields = clazz.getFields();
        for (Field field : fields) {
            int modifiers = field.getModifiers();
            System.out.println(field);
        }
        Method[] methods = clazz.getMethods();
        for (Method method : methods) {
            System.out.println(method);
        }
    }
}
